<template>
	<div>
		<Form inline>
			<FormItem label="题库名称">
				<Input type="text" v-model="examName" placeholder="请输入题库名称"></Input>
			</FormItem>
			<Button type="primary" @click="handleSubmit('formInline')">查询</Button>
		</Form>
		<Table border :columns="columns" :data="data"></Table>
		<Page :current="currentPage" :total="total" :page-size="pageSize" :page-size-opts="pageSizeOpts" @on-change="changePage" @on-page-size-change="changePageSize" show-sizer show-elevator show-total />
	</div>
</template>
<script>
	import axios from 'axios';
	export default {
		data() {
			return {
				columns: [{
						title: '考试名称',
						key: 'testName'
					},
					{
						title: '考试花费时间',
						key: 'testTime'
					},
					{
						title: '考试分数',
						key: 'score'
					},
					{
						title: '考试类型',
						key: 'testType'
					},
					// {
					//     title: 'Action',
					//     key: 'action',
					//     width: 150,
					//     align: 'center',
					//     render: (h, params) => {
					//         return h('div', [
					//             h('Button', {
					//                 props: {
					//                     type: 'primary',
					//                     size: 'small'
					//                 },
					//                 style: {
					//                     marginRight: '5px'
					//                 },
					//                 on: {
					//                     click: () => {
					//                         this.show(params.index)
					//                     }
					//                 }
					//             }, 'View'),
					//             h('Button', {
					//                 props: {
					//                     type: 'error',
					//                     size: 'small'
					//                 },
					//                 on: {
					//                     click: () => {
					//                         this.remove(params.index)
					//                     }
					//                 }
					//             }, 'Delete')
					//         ]);
					//     }
					// }
				],
				data: [],
				examName: '',
				currentPage: 1,
				pageSize: 20,
				total: 100,
				pageSizeOpts:[20,50,100,200,1000]
			}
		},
		mounted() {
			this.selectTestRecord();
		},
		methods: {
			show(index) {
				this.$Modal.info({
					title: 'User Info',
					content: `Name：${this.data6[index].name}<br>Age：${this.data6[index].age}<br>Address：${this.data6[index].address}`
				})
			},
			remove(index) {
				this.data6.splice(index, 1);
			},
			selectTestRecord() {
				axios({
					method: 'get',
					url: '/rc/api/findTestRecord'
				}).then(res => {
					this.data = res.data.data;
					this.$Message.success("查询成功");
				})
			},
			changePage(param){
				console.log(param)
			},
			changePageSize(param){
				console.log(param)
			}
			
		}
	}
</script>